home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / audio / drive / Cockpit.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  3.3 KB  |  105 lines

  1. /*
  2.  * Copyright 1992-1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. //////////////////////////////////////////////////////////////////////
  18. // Cockpit.h - definition of the cockpit class
  19. //////////////////////////////////////////////////////////////////////
  20.  
  21. #ifndef COCKPIT_H
  22. #define COCKPIT_H
  23.  
  24. #include "Defines.h"
  25. #include <fmclient.h>
  26.  
  27. class Car;
  28. class Engine;
  29.  
  30. class Cockpit {
  31.  
  32. public:
  33.  
  34.     Cockpit(Car *);
  35.     ~Cockpit();
  36.  
  37.     // draws dynamics portions of the cockpit
  38.     void draw_indicators(Boolean redraw) const;
  39.     
  40.     // draws static portions of the cockpit
  41.     void draw_cockpit(int window_width);
  42.  
  43.     // called when the window is resized to clear the overlay crap
  44.     void clear_indicators() const;
  45.  
  46.     // the hood is drawn within the out-the-window viewport
  47.     void draw_hood(int display_mode) const;
  48.     
  49.     void set_gas(float p) { _gas = p; };
  50.     void set_brakes(float p) { _brakes = p; };
  51.     void set_clutch(float p) { _clutch = p; };
  52.     void set_steering(float a) { _steering = a; };
  53.  
  54.     float get_gas() const { return _gas; };
  55.     float get_brakes() const { return _brakes; };
  56.     float get_clutch() const { return _clutch; };
  57.     float get_steering() const { return _steering; };
  58.     
  59. protected:
  60.  
  61.     void draw_gages(float world_per_pixel) const;
  62.     void draw_speedometer(float diam, float world_per_pixel) const;
  63.     void draw_tachometer(float diam, float world_per_pixel) const;
  64.     void draw_gas(float diam, float world_per_pixel) const;
  65.     void draw_temp(float diam, float world_per_pixel) const;
  66.     void draw_oil(float diam, float world_per_pixel) const;
  67.     void draw_fps(float diam, float world_per_pixel) const;
  68.     void draw_gear(float width, float height, float world_per_pixel) const;
  69.     void draw_needles(Boolean redraw) const;
  70.     void draw_overlapping_needles(Boolean redraw) const;
  71.     void draw_messages(Boolean redraw) const;
  72.     void draw_steering_spokes(Boolean draw, float angle) const;
  73.     void draw_steering_wheel() const;
  74.     void draw_dash() const;
  75.     void draw_icons() const;
  76.     void draw_timer(float width, float world_per_pixel) const;
  77.     void draw_times(Boolean redraw, float world_per_pixel) const;
  78.  
  79.     void center_string(
  80.         fmfonthandle font, float world_per_pixel, char *s) const;
  81.     
  82.     Car * _car; // car that this cockpit is in
  83.  
  84.     // locations of cockpit components
  85.     SbVec3f _steering_pos, _tach_pos, _speedo_pos, _gear_pos;
  86.     SbVec3f _gas_pos, _temp_pos, _oil_pos, _fps_pos, _timer_pos;
  87.     float _tach_size, _speedo_size;
  88.     float _gas_size, _temp_size, _oil_size, _fps_size;
  89.     float _gear_width, _gear_height;
  90.     float _timer_width;
  91.  
  92.     float _world_per_pixel;
  93.  
  94.     // 0.0 = not touched, 1.0 = depressed fully
  95.     float _gas;
  96.     float _brakes;
  97.     float _clutch;
  98.  
  99.     // 0 = straight up, positive counter clockwise degrees
  100.     float _steering;
  101. };
  102.  
  103. #endif
  104.     
  105.